import Vue from 'vue'
import Router from 'vue-router'

import Layout from '@/views/layout/index'
Vue.use(Router)

export const constantRouterMap = [
  {
    path: '',
    redirect: '/home',
    component: Layout,
    children: [
      {
          path: 'home',
          name: 'home',
          component: () => import('@/views/home/index')
      }, 
      {
        path: 'add-restaurant',
        name: 'add-restaurant',
        component: () => import('@/views/home/add-restaurant')
      },
      {
          path: 'restaurant-info-manage',
          name: 'restaurant-info-manage',
          component: () => import('@/views/home/restaurant-info-manage')
      },
      {
        path: 'restaurant-desk-manage',
        name: 'restaurant-desk-manage',
        component: () => import('@/views/home/restaurant-desk-manage')
      },
      {
        path: 'desk-code',
        name: 'desk-code',
        component: () => import('@/views/home/desk-code')
      },
      {
        path: 'order-manage',
        name: 'order-manage',
        component: () => import('@/views/home/order-manage')
      },
      {
        path: 'order-manage-detail',
        name: 'order-manage-detail',
        component: () => import('@/views/home/order-manage-detail')
      },
    ]
  },
  {
    path: '',
    redirect: '/cook',
    component: Layout,
    children: [
      {
        path: 'cook',
        name: 'cook',
        component: () => import('@/views/cook/cook')
      },
    ]
  },
  {
    path: '',
    redirect: '/print',
    component: Layout,
    children: [
      {
        path: 'print',
        name: 'print',
        component: () => import('@/views/print/print')
      },
    ]
  },
  {
    path: '/pay-restaurant',
    name: '/pay-restaurant',
    component: () => import('@/views/home/pay-restaurant')
  }
]

export default new Router({
  scrollBehavior: () => ({y: 0}),
  routes: constantRouterMap
})
